/* 
* @Author: anchen
* @Date:   2016-12-10 19:55:56
* @Last Modified by:   anchen
* @Last Modified time: 2017-01-13 11:58:04
*/

var sd = document.getElementsByClassName('zhuangtai');

for (var i = 0; i < sd.length; i++) {
  var value = sd[i].innerHTML;

	if (value == '忙碌中') {
	$('zhuangtai').css({
        background: '#E99700'
       });
	}else{
		$('zhuangtai').css({
        background: '#5B9B2D'
       });
	}
}

  //获取位置

   function  dingwei(){
   var geolocation = new BMap.Geolocation ();
    geolocation.getCurrentPosition (function (r) {
        if (this.getStatus () == BMAP_STATUS_SUCCESS) {
            var map = new BMap.Map ("ditu");
            // 编写自定义函数,创建标注
            var mk = new BMap.Marker (r.point);
            map.addOverlay (mk);
            map.panTo (r.point);
            var point = new BMap.Point (r.point.lng, r.point.lat);
            map.centerAndZoom (point, 16);
         // 随机向地图添加5个标注
           var bounds = map.getBounds();
           var sw = bounds.getSouthWest();
           var ne = bounds.getNorthEast();
           var lngSpan = Math.abs(sw.lng - ne.lng);
          var latSpan = Math.abs(ne.lat - sw.lat);
          for (var i = 0; i < 5; i ++) {
            var myIcon = new BMap.Icon("http://lbsyun.baidu.com/jsdemo/img/fox.gif", new BMap.Size(300,157));
             var point = new BMap.Point(sw.lng + lngSpan * (Math.random() * 0.7), ne.lat - latSpan * (Math.random() * 0.7));
             var mk1 = new BMap.Marker (point,{icon:myIcon});
              map.addOverlay (mk1);
              mk1.addEventListener("click",attribute);
            }
        } else {
            alert ('failed' + this.getStatus ());
        }
    }, {
        enableHighAccuracy: true
    });
    function attribute(e){
      var p = e.target;
   window.location.href = "详情页.html";
    }
   }

  
  


